//
//  RTJScoreView.m
//  RuiTaiJinProject
//
//  Created by jayson on 2019/1/3.
//  Copyright © 2019年 leewei. All rights reserved.
//

#import "RTJScoreView.h"
#import "LewPopupViewController.h"

@implementation RTJScoreView


+ (instancetype)defaultPopupViewWithFrame:(CGRect)rect data:(NSDictionary *)data{
    
    return [[RTJScoreView alloc]initWithFrame:rect data:data];
}


- (id)initWithFrame:(CGRect)frame data:(NSDictionary *)data
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [[NSBundle mainBundle] loadNibNamed:[[self class] description] owner:self options:nil];

        _scoreView.frame = frame;
        [self addSubview:_scoreView];
        
        _scoreView.layer.masksToBounds = YES;
        _scoreView.layer.cornerRadius = 9;
       
        _titleLab.text = data[@"name"];
        _img.image = [UIImage imageNamed: data[@"img"]];
        _levelLab.text = data[@"level"];
        
        
    }
    return self;
}

- (IBAction)cancel:(id)sender {
    
    if (self.sureClick) {
        
        self.sureClick(NO);
    }
    
    [_parentVC lew_dismissPopupView];

}
- (IBAction)sureBtn:(id)sender {
    
    if (self.sureClick) {
        
        self.sureClick(YES);
    }
    
    [_parentVC lew_dismissPopupView];

}

-(void)withSureClick:(scroreSureBtnBlock)block{
    
    _sureClick = block;
}

@end
